//
//  MyActivityRecomendModel.m
//  FD
//
//  Created by xiaofang wang on 2019/1/16.
//  Copyright © 2019年 ZhiYuan Network. All rights reserved.
//

#import "MyActivityRecomendModel.h"

@implementation MyActivityRecomendModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName {
    return @{@"couponId":@"id"};
}

#pragma mark - 单独转换
- (NSString *)thumbnail {
    //拼接图片前缀
    if ([_thumbnail hasPrefix:kPicDomain]) {
        return _thumbnail;
    }
    return [NSString stringWithFormat:@"%@%@",kPicDomain,_thumbnail];
}

- (BOOL)isReceive {
    NSNumber *receiveNum = self.user[@"receive"];
    return [receiveNum boolValue];
}

- (NSString *)activeTimeStr {
    NSString *timeStr = [self timestrFromTimeStamp:self.activeDate];
    return timeStr;
}

- (NSString *)expireTimeStr {
    NSString *timeStr = [self timestrFromTimeStamp:self.quietDate];
    return timeStr;
}

- (NSString *)timestrFromTimeStamp:(NSNumber *)timeStamp {
    NSDateFormatter *dateFmt = [[NSDateFormatter alloc] init];
    
    [dateFmt setDateFormat:@"yyyy-MM-dd"];
    
    NSTimeInterval interval = [timeStamp doubleValue];
    
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval / 1000];
    
    NSString *timeStr = [dateFmt stringFromDate:date];
    
    return timeStr;
}

@end
